this._thumbnailsBox =
new WorkspaceThumbnail.ThumbnailsBox(this._workspaceAdjustment);
+ this._thumbnailsBox.connect('notify::should-show',
+ () => this._updateThumbnailsBox());
+
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay(
this,
this._workspaceAdjustment,
}
_updateThumbnailsBox(animate = false) {
+ const { shouldShow } = this._thumbnailsBox;
const { searchActive } = this._searchController;
const [opacity, scale, translationY] = this._getThumbnailsBoxParams();
- const thumbnailsBoxVisible = !searchActive && opacity !== 0;
+ const thumbnailsBoxVisible = shouldShow && !searchActive && opacity !== 0;
if (thumbnailsBoxVisible) {
this._thumbnailsBox.opacity = 0;
this._thumbnailsBox.visible = thumbnailsBoxVisible;
'scale', 'scale', 'scale',
GObject.ParamFlags.READWRITE,
0, Infinity, 0),
+ 'should-show': GObject.ParamSpec.boolean(
+ 'should-show', 'should-show', 'should-show',
+ GObject.ParamFlags.READABLE,
+ true),
},
}, class ThumbnailsBox extends St.Widget {
_init(scrollAdjustment) {
this._stateUpdateQueued = false;
this._animatingIndicator = false;
+ this._shouldShow = true;
+
this._stateCounts = {};
for (let key in ThumbnailState)
this._stateCounts[ThumbnailState[key]] = 0;
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
this._settings.connect('changed::dynamic-workspaces',
- this._updateSwitcherVisibility.bind(this));
+ () => this._updateShouldShow());
Main.layoutManager.connect('monitors-changed', () => {
this._destroyThumbnails();
});
}
- _updateSwitcherVisibility() {
- let workspaceManager = global.workspace_manager;
+ _updateShouldShow() {
+ const { nWorkspaces } = global.workspace_manager;
+ const shouldShow =
+ this._settings.get_boolean('dynamic-workspaces') || nWorkspaces > 1;
+
+ if (this._shouldShow === shouldShow)
+ return;
- this.visible =
- this._settings.get_boolean('dynamic-workspaces') ||
- workspaceManager.n_workspaces > 1;
+ this._shouldShow = shouldShow;
+ this.notify('should-show');
}
_activateThumbnailAtPoint(stageX, stageY, time) {
this.addThumbnails(0, workspaceManager.n_workspaces);
- this._updateSwitcherVisibility();
+ this._updateShouldShow();
}
_destroyThumbnails() {
this.removeThumbnails(removedIndex, removedNum);
}
- this._updateSwitcherVisibility();
+ this._updateShouldShow();
}
addThumbnails(start, count) {
childBox.y2 += indicatorBottomFullBorder;
this._indicator.allocate(childBox);
}
+
+ get shouldShow() {
+ return this._shouldShow;
+ }
});